//
//  FacePannel.m
//  WXWeibo
//
//  Created by apple on 16/5/20.
//  Copyright © 2016年 zic_magic. All rights reserved.
//

#import "FacePannel.h"

@implementation FacePannel

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self _createView];
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}


- (void)_createView {
    
    _faceView = [[FaceView alloc] initWithFrame:CGRectZero];

    _scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, _faceView.height)];
    _scroll.pagingEnabled = YES;
    _scroll.showsHorizontalScrollIndicator = NO;
    _scroll.contentSize = CGSizeMake(3 * kScreenWidth, _faceView.height);
    _scroll.delegate = self;
    _scroll.clipsToBounds = NO;
    
    
    
    _page = [[UIPageControl alloc] initWithFrame:CGRectMake(0, _faceView.bottom, kScreenWidth, 30)];
    _page.numberOfPages = 3;
    _page.currentPage = 0;
    
    
    self.width = kScreenWidth;
    self.height = _faceView.height + _page.height;
//    self.autoresizingMask = NO;
    [_scroll addSubview:_faceView];
    [self addSubview:_scroll];
    [self addSubview:_page];
    
}


- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    
    _page.currentPage = scrollView.contentOffset.x / kScreenWidth;
    
    
    
}

- (void)drawRect:(CGRect)rect {
    
    UIImage *bgImage = [UIImage imageNamed:@"emoticon_keyboard_background"];
    
    [bgImage drawInRect:rect];
}




@end
